﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CallVertex;
using Oracle.DataAccess.Client;

namespace ConsoleVertexClient
{
    class Program
    {
        static void Main(string[] args)
        {
            ConfigureUI();

            SalesTaxCalc stc = new SalesTaxCalc();
            //SalesTaxCalc._addressRecord ar = new SalesTaxCalc._addressRecord();
            Dictionary <int, SalesTaxCalc._addressRecord> ar;
            ar = new Dictionary<int, SalesTaxCalc._addressRecord>();
            OracleConnection ocConnection = new OracleConnection();
            ocConnection.ConnectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=pion.modspace.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=prod8)));User Id=space;Password=space_dev991;";
            ocConnection.Open();
            stc.oConnection = ocConnection;
            string ver = stc.getVertexVersion("QSU", ocConnection);
            Console.WriteLine("Version --> " + ver);
            
            ///summary
            ///Ouch said the class when it missed a cast to dictionary.
            ///summary
            
            ar = (Dictionary<int,SalesTaxCalc._addressRecord>) stc.ValidateAddress("", "CHESTER", "PA", "");
            foreach (var item in ar) 
            {
                Console.WriteLine(item.Key.ToString());
                Console.WriteLine( item.Value.City.ToString());
                Console.WriteLine(item.Value.County.ToString());
                Console.WriteLine( item.Value.State.ToString());
                Console.WriteLine( item.Value.ZipCode.ToString());
                Console.WriteLine( item.Value.GeoCode.ToString()); 
            }
            ocConnection.Close();
        }

        private static void ConfigureUI()
        {
            //Console Welcome Screen
            Console.Title = "C# Vertex Client Tester";
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.BackgroundColor = ConsoleColor.Black;
            Console.WriteLine("*******************************************************************************************");
            Console.WriteLine("**********************************Welcome to the Vertex C# Client Tester*******************");
            Console.WriteLine("*******************************************************************************************");
            Console.WriteLine("*******************************Author: Abhijit Shrikhande**********************************");
            Console.WriteLine("*******************************************************************************************");
        }
    }
}
